/**
 * Selling Partner API for Listings Items
 * The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API.  For more information, see the [Listings Items API Use Case Guide](https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2021-08-01-use-case-guide).
 *
 * The version of the OpenAPI document: 2021-08-01
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */

import { ApiClient } from '../ApiClient.js'

/**
 * The Money model module.
 * @module listingsitems_v2021_08_01/model/Money
 * @version 2021-08-01
 */
export class Money {
  /**
   * Constructs a new <code>Money</code>.
   * The currency type and amount.
   * @alias module:listingsitems_v2021_08_01/model/Money
   * @class
   * @param currencyCode {String} Three-digit currency code in ISO 4217 format.
   * @param amount {String} A decimal number with no loss of precision. Useful when precision loss is unnaceptable, as with currencies. Follows RFC7159 for number representation.
   */
  constructor (currencyCode, amount) {
    this.currencyCode = currencyCode
    this.amount = amount
  }

  /**
   * Constructs a <code>Money</code> from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {Money} obj Optional instance to populate.
   * @return {Money} The populated <code>Money</code> instance.
   */
  static constructFromObject (data, obj) {
    if (data) {
      switch (typeof data) {
        case 'string':
          obj = String(data)
          break
        case 'number':
          obj = Number(data)
          break
        case 'boolean':
          obj = Boolean(data)
          break
      }
      obj = obj || new Money()
      if (data.hasOwnProperty('currencyCode')) { obj.currencyCode = ApiClient.convertToType(data.currencyCode, 'String') }
      if (data.hasOwnProperty('amount')) { obj.amount = ApiClient.convertToType(data.amount, 'String') }
    }
    return obj
  }
}

/**
 * Three-digit currency code in ISO 4217 format.
 * @member {String} currencyCode
 * @type {String}
 */
Money.prototype.currencyCode = undefined

/**
 * A decimal number with no loss of precision. Useful when precision loss is unnaceptable, as with currencies. Follows RFC7159 for number representation.
 * @member {String} amount
 * @type {String}
 */
Money.prototype.amount = undefined
